<template>
	<view class="content">
		<resource-list :resourceList = "resourceList"></resource-list>
		<uni-load-more :status="loadingType"></uni-load-more>
	</view>
</template>

<script>
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
	import resourceList from "@/components/resource-list.vue";
	import {
		mapState,mapMutations
	} from 'vuex';
	export default {
		components: {
			uniLoadMore,
			resourceList
		},
		data() {
			return {
				loadingType:'',
				resourceList:[]
			};
		},
		
		onLoad(options){
			this.inquiryFavorite();
		},
		computed: {
			...mapState(['hasLogin', 'userInfo'])
		},
		methods: {
			...mapMutations(['login']),
			//查询收藏的商品
			inquiryFavorite(){
				let postData = {
					userUuid: this.userInfo.userUuid
				};
				//加载中
				this.loadingType = "loading";
				this.$api.request.inquiryResourceFavorite(postData, res => {
					this.resourceList = res.body.data.resourceList;
					this.loadingType = "noMore";
				},true);
			},
			//详情
			navToDetailPage(item){
				let id = item.productUuid;
				uni.navigateTo({
					url: `/pages/product/product?id=${id}`
				})
			}
		},
	}
</script>

<style lang="scss">
	page{
		background: $bg-color-light;
	}
	.container{
		margin: 0 $page-row-spacing;
	}

</style>
